#ifndef ENERGYDASHBOARD_H
#define ENERGYDASHBOARD_H

#include "serialtoolwidget.h"

#include <QWidget>
#include <QDateEdit>
#include <QComboBox>
#include <QLabel>
#include <QChartView>
#include <QTableWidget>
#include <QPushButton>
#include <QBarSet>

class EnergyDashboard : public QWidget
{
    Q_OBJECT
public:
    explicit EnergyDashboard(QWidget *parent = nullptr);
    void setupUI();
    QWidget* createControlPanel();
    QWidget* createChartTab();
    QWidget* createDataTab();
    QLabel* createSummaryLabel(const QString &title, const QString &value, const QString &color);
    void loadSampleData();
    void updateCharts();
    void setupConnections();


    // UI组件
    QDateEdit *dateFrom;
    QDateEdit *dateTo;
    QComboBox *categoryCombo;
    QComboBox *dimensionCombo;
    QChartView *mainChart;
    QChartView *secondaryChart;
    QTableWidget *dataTable;
    QLabel *lblTotalSales;
    QLabel *lblAvgPrice;
    QLabel *lblTopCategory;
    QPushButton *analyzeBtn;
    SerialToolWidget *serial_tool_widget;
    QChart *barChart;

public slots:
    //开始数据分析
    void analyze_data();

signals:
};

#endif // ENERGYDASHBOARD_H
